import { postHandle } from '@/api'
export const mixin = {
  data() {
    return {
      hotWorkData: [],
      productionOperationData: [],
      hotWorkSupervisionData: [],
      maxPageSize: {
        p: 1,
        ps: 9999
      }
    }
  },
  computed: {
    entSpaceId() {
      return this.$store.getters.entSpaceId
    },
    spaceId() {
      return this.$store.getters.spaceId
    }
  },
  methods: {
    // 动火作业
    getHotWorkData() {
      let params = {
        d: {
          filters: [
            {
              field: 'pdCode',
              operator: 'EQUALS',
              value: 'hotWork'
            }
          ],
          page: this.maxPageSize,
          sorts: [{ field: 'ct', isDesc: false }]
        }
      }
      postHandle('/api/v1/welder-sbtx-second/dictionary', params).then(res => {
        this.hotWorkData = res.result
      })
    },
    // 生产运行
    getProductionOperationData() {
      let params = {
        d: {
          filters: [
            {
              field: 'pdCode',
              operator: 'EQUALS',
              value: 'productionOperation'
            }
          ],
          page: this.maxPageSize,
          sorts: [{ field: 'ct', isDesc: false }]
        }
      }
      postHandle('/api/v1/welder-sbtx-second/dictionary', params).then(res => {
        this.productionOperationData = res.result
      })
    },
    // 动火监督
    getHotWorkSupervisionData() {
      let params = {
        d: {
          filters: [
            {
              field: 'pdCode',
              operator: 'EQUALS',
              value: 'hotWorkSupervision'
            }
          ],
          page: this.maxPageSize,
          sorts: [{ field: 'ct', isDesc: false }]
        }
      }
      postHandle('/api/v1/welder-sbtx-second/dictionary', params).then(res => {
        this.hotWorkSupervisionData = res.result
      })
    }
  },
  created() {
    this.getHotWorkData()
    this.getProductionOperationData()
    this.getHotWorkSupervisionData()
  }
}
